package com.config;

import com.example.annotation.EnableHelloSelector;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

import java.util.Map;

public class HelloConfigSelector implements ImportSelector {

    @Override
    public String[] selectImports(AnnotationMetadata annotationMetadata) {

        Map<String, Object> metaData = annotationMetadata.getAnnotationAttributes(EnableHelloSelector.class.getName());

        Boolean isLinux = (Boolean) metaData.get("isLinux");

        return new String[]{ isLinux? HelloConfig.class.getName(): HelloConfig2.class.getName() };
    }
}
